home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / mpe_v1_0.dem < prev    next >
Internet Message Format  |  1995-03-23  |  12KB

  1. From comp.sys.handhelds Fri May 24 22:32:05 1991
  2. Path: seq!ecsgate!mcnc!taco!lll-winken!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!haven.umd.edu!decuac!pa.dec.com!nntpd.lkg.dec.com!ryn.mro4.dec.com!pinbot.enet.dec.com!ervin
  3. From: ervin@pinbot.enet.dec.com (Joseph James Ervin)
  4. Newsgroups: comp.sys.handhelds
  5. Subject: HP48 MPE uuencoded DEMO
  6. Message-ID: <4844@ryn.mro4.dec.com>
  7. Date: 15 May 91 19:23:32 GMT
  8. Sender: guest@ryn.mro4.dec.com
  9. Reply-To: ervin@pinbot.enet.dec.com (Joseph James Ervin)
  10. Organization: Digital Equipment Corporation
  11. Lines: 211
  12.  
  13. The following is an excerpt from the MPE User's guide, describing how to
  14. download and use the MPE demo application.
  15.  
  16. *********************************
  17.  
  18.      4.1  Application Overview
  19.  
  20.      This demo application is a simple demonstration of how MPE can be used
  21.      to  do  graphical  animation of several objects on the screen at once.
  22.      This also provides a good visual  demonstration  of  the  CPU  loading
  23.      effects described in earlier sections.
  24.  
  25.      Basically,  the  application  consists  of  a  fire  button  and  four
  26.      "bullets".   This  application uses the [+] button as the fire button.
  27.      When the user starts the application, the screen blanks and waits  for
  28.      the  user to press the fire button.  For each press of the [+] button,
  29.      the application will fire a bullet.  The bullets start  at  the  upper
  30.      left  of  the  screen and move down the screen, row by row, until they
  31.      reach the bottom of the screen.  When any  bullet  reaches  the  lower
  32.      right  of  the screen, the application stops.  When the user has fired
  33.      all four bullets, the fire button is disabled for the remainder of the
  34.      application.   The  [.]  key  quits  the  application.   Refer  to the
  35.      following section for how to download and run the application.
  36.  
  37.  
  38.  
  39.      4.2  Downloading And Running The Application
  40.  
  41.      Included in this distribution is  the  uuencoded  binary  file.   This
  42.      binary  file is a directory containing the machine language code which
  43.      makes up the MPE application, and a short RPL program which  runs  it.
  44.      The  user  should  uudecode  this file and then download the resulting
  45.      binary file in the usual manner to the HP48SX (make sure  to  set  the
  46.      HP48SX  kermit  to  binary  mode.  The RPL program, "DEMO", in the new
  47.      directory serves only to clear the display and set the display to PICT
  48.      memory  before  running the machine language application ("XXX").  You
  49.      should _not_ run the "XXX" program directly, since if PICT memory  has
  50.      been  purged (by doing a PICT PURGE), then the application may corrupt
  51.      memory.  Once started by  pressing  the  button  labeled  "DEMO",  the
  52.      machine  language  program  can be aborted at any time by pressing the
  53.      [.] button.
  54.  
  55.     
  56.      4.3  Process Descriptions
  57.  
  58.      The following sections describe each of the seven processes which make
  59.      up the application.  Note that processes #1 and #2 are not integral to
  60.      the application and could be omitted.
  61.  
  62.  
  63.     
  64.      4.3.1  Process #1
  65.  
  66.      This is the process which is auto-executed  by  MPE  at  startup.   In
  67.      terms  of the application, the only thing that this process does is to
  68.      start up the keyboard scanner process  (#7).   Another  function  that
  69.      this  process  performs,  in  conjunction  with  process #2 is to do a
  70.      register context integrity test periodically while the application  is
  71.      running.  This was written mainly for debugging MPE, but may be useful
  72.      to the programmer in general, so I have left it in.  It runs once  per
  73.      second, so it does not add significant overhead to the application.
  74.  
  75.  
  76.  
  77.      4.3.2  Process #2
  78.  
  79.      This process does nothing except clear all  the  processor  registers.
  80.      The  purpose of this process is to work with process #1 to implement a
  81.      register context integrity test.
  82.  
  83.    
  84.  
  85.      4.3.3  Processes #3, #4, And #5.
  86.  
  87.      These processes are grouped together here because they share the  same
  88.      process  definition.   This process definition shows a good example of
  89.      how to share code between two or more processes.  The  code  for  this
  90.      process  definition  makes  use of the IF_PROC/ENDIF_PROC macros to do
  91.      conditional execution of certain sections of code based on the current
  92.      context ID.  For example, the three bullets owned by processes #3, #4,
  93.      and #5 all move at different speeds on the screen.  This was done here
  94.      to  visually  show the independence of the bullet processes running in
  95.      the system.  The process definition uses the IF_PROC/ENDIF_PROC macros
  96.      to  schedule  the  correct  process  at  the  correct  interval,  thus
  97.      determining the speed of each bullet.
  98.  
  99.      One thing to note is that this process definition does not attempt  to
  100.      control the speed of a bullet with great accuracy.  In other words, as
  101.      the four bullets are fired and the CPU becomes  more  heavily  loaded,
  102.      the  speed  of  the  bullets corresponding to processes #3, #4, and #5
  103.      will slow down slightly.  This  is  due  to  process  latency  in  the
  104.      scheduler.   Process  #6 shows a similar bullet process, but one which
  105.      keeps track of absolute time and maintains an accurate velocity on the
  106.      screen, independent of CPU loading.
  107.  
  108.  
  109.  
  110.      4.3.4  Process #6
  111.  
  112.      This  process  definition  is  very  similar  to  that  which  defines
  113.      processes #3, #4,and #5.  The main difference is that process #6 keeps
  114.      track of absolute time, making sure that its bullet moves  at  exactly
  115.      the  velocity  indicated in the process definition.  In this way, even
  116.      though the bullet for this process does not start  until  the  CPU  is
  117.      already  very  busy with the other three bullets, it will maintain its
  118.      velocity at the expense of the other three bullets.
  119.  
  120.          
  121.      The effects of the use  of  absolute  time  in  this  process,  versus
  122.      relative  time in the other three bullet processes, can be seen in two
  123.      ways.  The first way is that after firing the four bullets, it  should
  124.      be  discernible  that  the  fourth  bullet (process #6) moves slightly
  125.      faster than the second one (process #4).  By examining the definitions
  126.      of these processes, one quickly sees that processes #4 and #6 have the
  127.      same rescheduling interval.  The  difference  in  speed  is  therefore
  128.      attributable  to  the  time that process #4 loses while sitting in the
  129.      RUN_LIST waiting to be run by the scheduler.  Since process  #6  keeps
  130.      track  of  absolute  time  internal  to  itself,  this queuing time is
  131.      accurately recovered each time the process is invoked.
  132.  
  133.      The second way that the use of absolute time in process #6 can be seen
  134.      is  by  pressing  and briefly holding the [ON] key.  Pressing this key
  135.      temporarily halts execution of the calculator, causing  all  processes
  136.      to pause.  When the key is released, however, the bullet of process #6
  137.      will quickly "zip" ahead to catch up to where it should be.  A similar
  138.      effect  can  also  be  seen  by  pressing  and  holding some other key
  139.      (besides  [ON]).   Since  the  keyboard  controller  causes  lots   of
  140.      interrupts  in when this is done, it has the effect of heavily loading
  141.      the CPU.  What can be seen on the display is that while the user holds
  142.      down  a  key and thereby loads the CPU, the three bullets which do not
  143.      use absolute timing slow down noticably, while the bullet for  process
  144.      #6  maintains  its  correct  average  velocity.   The  manner in which
  145.      process #6 "catches up" to where it should  be  can  be  seen  in  the
  146.      bullet's jumpiness.
  147.  
  148.  
  149.  
  150.      4.3.5  Process #7
  151.  
  152.      This process comprises the  keyboard  scanner.   This  process  simply
  153.      checks the keybuffer for the [+] key, and if it finds it then the next
  154.      bullet process is scheduled for execution.  If the [.] key is pressed,
  155.      this  process will cause the application to exit and continue with the
  156.      RPL thread.  This process runs approximately 8 times per second.
  157.  
  158. *******************************************************************************
  159.  
  160.  
  161. Here's the uuencoded demo application.  
  162.  
  163. ****************************CUT HERE*****************************************
  164. begin 750 mpe.
  165. M2%!(4#0X+466*O!_8Q,    #6EI: \PM4#0!ME/I&!>S--0!  D         
  166. M#-DKG;U-&1>S--0!  <#"!H7LS34 0 "$!P7LS34 0 $B!D7LS34 0 %R!D7
  167. MLS34 0 &4AD7LS34 0  "!D7LS34 0                              
  168. M                  !-&1>S--0!  D         #-FKF+T&          ?8
  169. M"P       <@*      #VFA:S--0!    4#BVA4-=TME;$;ZJJJJJJJJJJJNJ
  170. MJJJJJJJJK*K:JJJNJJJJJJJJJJ^JJJJJJJJJL*JJJJJJJJJQJJJJJJJJJK*J
  171. MJJJJJJJJ5MH;7KX                                             
  172. M                                    VMJ+<[X          %41!P  
  173. M    0!%7%7$                     OAD'                        
  174. M    7MO;@+X!         %\1!P      0!'W%7$                     
  175. MOAD'                            XMO;@+X!         %41!P      
  176. M0!%7%7$                     OAD'                            
  177. M9MS;@+X"         %T1!P      0!'7%7%2&1>S--0!            OAD'
  178. M                            ZMPKH;X&          8         Z@0'
  179. M   &                                                    ;MW[
  180. MLKY,V@NMO53;B[V]7-P+SKUDW8O>O?B;9X"Q%'O"_S'&$F,82T.:^\\21!A+
  181. M0\T"P!)&082Q%%O'_S'&$F,82T/H^\\21!A+0\X&P!)&082Q%#O,_S'&$F,8
  182. M2T,V_,\21!A+0X0(P!)&082Q%!O1_S'&$F,82T.$_,\21!A+0YD(P!)&082Q
  183. M%/O5_S'&$F,82T/2_,\21!A+0V,(P!)&082Q%-O:_S'&$F,82T,@_<\21!A+
  184. M0RT(P!)&082Q%+O?_S'&$F,82T-N_<\21!A+0P$*P!)&082Q%)OD_S'&$F,8
  185. M2T.\_<\21!A+0SD+P!)&082Q%-OA_S'&$F,82T-D^L\21&&$L314K?\L011&
  186. M&$M#1OO/$D1AA+$T=+O_+$$41AA+0RC\SQ)$882Q-)3)_RQ!%$882T,*_<\2
  187. M1&&$L32TU_\L011&0PH @+$4>XG_,<828_H0A&$1]NRH+H^Q%/N&_S'&$F/Z
  188. M$(170P@H$7 [@H 2"FJL;NJG#P& L30T@_\L,8>Q%!N!_S'&$F/7/E%T^J4/
  189. M09O&"K<!!O]Q$747'/F9= 1@V1\7<8^A%K!&&&H ZINN(K<Y^J4.&&H &$M#
  190. MKO?/$G,P&&H0&$NQA/<?8RPQII]1=/H0E'?YYPL82[%L]Q]C+#&&H181A$< 
  191. M&#OZHF[ZRL;&@K$4^\#_,<828S'"&B-!%D-!$D9!!A8#47;Z%?91=OH7]D$6
  192. M1C$79#$71E%R 1#V47(!$?91<@$2]E%R 1/V47(!%&-P$.<I^J)N^LK&QA(C
  193. M[6#M&$NQ:/L?8RPQ%B.L,1!D,11D,:1/47!AK_]1=/H?]G!!%$8Q%T0Q%T81
  194. M$ 47]A$1!1?V$1(%%_81$P47]A$4!1=C$!AJ(&EH$; 3!^EJ8 =@@8 O?09#
  195. M8@" H0^(?U,&^)MG@+$4NUS_,<828_H2Y &(+WT&^#=E@+]Y!OJ H1:"H0^ 
  196. M+WT&^#=E@+]Y!MA#4: O$PIJKG_Z$  82T->]<\2<T&;AFYWUAAJ 6F\CH!"
  197. M8P" H0^ +WT&^#=E@+]Y!AA+L1#U'V,L,:8O01Z ^-)G@']3!OB;9X ]% 48
  198. M:B%!&1<1&U4'@;$4.TS_,<828_H0A.?5&#LQAK$46T;_,<828_H4!1?V^J^O
  199. M^A\%%_9!%$8Q%T0Q%V,P&$NQ)/0?8RPQIJ]1=OH5]E%V^A?V019&,1=D,1=C
  200. M^@9S=X_O, $'^Q 82T,,],\28T$:8Q 82T/D\\\28T$:8Q"JJJJJJJJJJAA+
  201. ML8#U'V,L,19&&$M#>P# $D082[&6\Q]C+#$698> $@>'UQA+L:3_'V,L,18E
  202. MIX][I&_ZMV<QM&<QM6<!N&<!N6<!NF<!NV<!C+$T=/7_+#$6)1=C^I8'$ @H
  203. M!   MA![EC<0""@4  !6#WNT1S&&*A (*"0  )8->Q1C,8<J$ @H-   U@LQ
  204. MMT<1B"H0""A$   6"GL4D:@"@8!"!0!@B+!'$8HJ$ @H9   ]@9[%+&H H& 
  205. M0@< 8%:P1Q&,*A (*(0  -8#I[@82[$H\A]C+#$69:</""CT_P%Z@H 2 J>_
  206. M)M08^@#XTF> ?U,&^)MG@#T4!?H0 S&AC_JF?P$0$ $2, %T#8NQ%+L:_S'&
  207. M$F-1=@@H$7"-:]6,L31D"  L8&?7^J)N^LK&QH*Q%)MD_S'&$F,QPAHC019#
  208. M80071+%E!1=D&/B2&/B2?0@HY(< +!CZH/J@C@@H\+TQ%(6P4;TQIPX),+-!
  209. M"4"U00E AH ""(R  B<0E>$W\:!>A@6][.H0<U$),8>  @^,@ (@$)5A+X" 
  210. M @Z,@ (A$)5A%X"  @R,@ (C$)6!H1^*>PG80U%PL8FQ%/L$_S'&$F-1=@$8
  211. M8QA+L4+P'V,L,1:D,38QD&83^H" 0A\!8&\08QA+L0SP'V,L,1:D,39!D&83
  212. M^H" 0I\ 8#D08QA+L=;O'V,L,1:D,391D&83^H" 0M\ 8 ,0@7H2@*>X$7B#
  213. M:<N*L10[/?\QQA)C882Q-+0& "Q!%%M6<$&&@2^)@2_9AX!"?@C @J$/J@\!
  214. M@+$46_+^,<828U%V :@/ZHB  M\;0U$(&]4;<^J0 #,;E !4&Y0 9 @H@, (
  215. M*' "41E^$P_J95C0RZX.,1>5$',(*/# ""@  E$9]@((*.# ""@0 E$9=@$(
  216. M*,# ""@P E$9&/JAN)> /10%^H" 0I\ $(%Z&@!WHA&0KQWHB/<1J \(*&%P
  217. M&6AA:1J/L12;+O\QQA)C882Q-*0! "Q!-"&@7A,&ZG>P0 SH+O<&!Q,Q:<(Q
  218. M\9(F#.@2]T8%V$-1L%;JA*$&H+[I^J#6Z.KVQ@+HX/882[%^[1]C+#&&H180
  219. M98?^=8^Q%+O5_C'&$F-1=OJ @"+_HR<(*'& WG)O=1B[3G!10H$0990D(@C]
  220. M2Q9%%&,(B9 ",=00I" -,%030$!4U/1$T-D"'C;R)1YT*N"D A4         
  221. @  #@I (5            L!(#\.*!Y (#6EI:.3:R$@-T
  222.  
  223. end
  224.  
  225.